<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h2>登录</h2>
    <form action="login" method="post">
        <table>
            <tr>
                <td> 用户名：</td>
                <td> <input type="text" name="uname"></td>
            </tr>
            <tr>
                <td> 密码：</td>
                <td><input type="text" name="pwd"></td>
            </tr>
            <tr>
                <td>验证码：</td>
                <td><input type="text" name="code"><img src="validateCode" alt=""><a href="#" >看不清</a></td>
            </tr>
            <tr>
                <td><button>提交</button></td>
                <td></td>
            </tr>
        </table>
    </form>

    <script>
        var link = document.querySelector("a");
        var codeImg = document.querySelector("img");
        link.onclick = function (ev) {
            codeImg.src = "validateCode?n="+Math.random();
        }
    </script>
</body>
</html>